﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Core;

namespace Wiki.Controllers
{
    public class ContentController : Controller
    {
        //
        // GET: /Content/

        public ActionResult Show(Guid id)
        {
            Wiki.Models.WikiEntities we = new Models.WikiEntities();
            Models.WikiPage p = we.WikiPages.First(m => (m.WikiPageId == id && m.IsDroppedYN == "N"));
            WikiPlex.WikiEngine engine = new WikiPlex.WikiEngine();
            ViewBag.ContentText = engine.Render(p.ContentText);
            ViewBag.WikiPageId = p.WikiPageId;
            ViewBag.CanEdit = UserPermissions.HasPermission("Can Modify Domain");
            return PartialView(p);
        }

    }
}
